Skip to content

Add opt-in BM25 tool search for large catalogs - #1449

Draft
jokemanfire with Copilot wants to merge 2 commits into
mainfrom
copilot/feat-built-in-tool-search
Draft

jokemanfire with Copilot wants to merge 2 commits into
mainfrom
copilot/feat-built-in-tool-search

Conversation

Copilot AI commented Nov 12, 2026 •

Copy link
Copy Markdown

Large tool catalogs consume model context and reduce tool-selection accuracy. This adds server-side discovery and a standalone search API for gateways, behind a dependency-free tool-search feature.

  • Search index: Lazy BM25 Okapi ranking over names, titles, descriptions, and optional parameter metadata. Returns full tool definitions and scores; supports catalog replacement.
  • Server wrapper: ToolSearchServer replaces discovery with search_tools / call_tool, supporting always-visible tools, configurable names, and a default five-result limit.
  • Behavior: Original tools remain directly callable. Dispatch rejects synthetic-tool recursion and preserves metadata and retry state. Each listing/search fetches all catalog pages; the index rebuilds only when definitions change.
  • Scope: Delegates non-tool handler behavior unchanged. Includes API documentation; optional regex search is deferred.
use rmcp::tool_search::{ToolSearchIndex, ToolSearchServer};

let index = ToolSearchIndex::new(tools);
let hits = index.search("create a github issue", 5);

// Alternatively, expose synthetic discovery tools:
let server = ToolSearchServer::new(my_handler);

Search controls discovery, not authorization; underlying handlers retain access enforcement.

Copilot AI changed the title [WIP] Add built-in tool search (BM25) for FastMCP Add opt-in BM25 tool search for large catalogs Nov 12, 2026
Copilot AI requested a review from jokemanfire November 12, 2026 14:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: built-in tool search (BM25) for large tool catalogs, like FastMCP's search_tools

2 participants